<?php defined('_JEXEC') or die('Restricted access');
error_reporting(E_ALL); 
ini_set("display_errors", 1);

define('ASSETS_IMAGES', 'components'.DS.'com_docario'.DS.'assets'.DS.'images');
define('ASSETS_JS', 'components'.DS.'com_docario'.DS.'assets'.DS.'js');

JHTML::_('behavior.mootools');
JHTML::_('behavior.modal');
$document =& JFactory::getDocument();
$document->addScript('components'.DS.'com_docario'.DS.'assets'.DS.'js'.DS.'docario.js');
$document->addStyleSheet('components'.DS.'com_docario'.DS.'assets'.DS.'css'.DS.'docario.css');

// Require the base controller
require_once JPATH_COMPONENT.DS.'controller.php';
    
// Initialize the dedicated controller
if ($controller = JRequest::getWord('controller')) {
    // determine path
    $path = JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php';
    if (file_exists($path)) {
        require_once $path;
    } else $controller = '';
}

$classname = 'DocarioController'.$controller;
$controller = new $classname();

$options = JComponentHelper::getParams('com_docario');
$guestallowed = $options->get('guestuser');

// Check guest mode
$user = JFactory::getUser();
if (($user->id == 0) && !$guestallowed) JRequest::setVar('view', 'guestnotallowed');

// Perform the Request task
$controller->execute(JRequest::getVar('task'));
$controller->redirect();

?>
